<?php
/**
 * Created by zxk7516@foxmail.com  Date: 2017/10/20  Time: 20:00
 */

namespace app\Admin\Controllers;

use App\Baby;
use App\CourseSubscribe;
use Illuminate\Support\Facades\DB;

class AdminDashboard
{

    public static function new_register()
    {
        $title = '未审核用户';
        $url = '/admin/baby?state=0';
        $number = Baby::where('state', '0')->count();
        return view('admin.Dash.dashboard', compact('title', 'number','url'));
    }

    public static function subscribes()
    {
        $title = '预约人次';
        $url = '/admin/subscribe';
        $time = date('Y-m-d H:i:s', time());
        $number = DB::table('course_subscribes')
            ->leftJoin('course_times', 'course_times.id', '=', 'course_subscribes.course_time_id')
            ->where('course_times.course_time', '>', $time)
            ->count();
        return view('admin.Dash.dashboard', compact('title', 'number','url'));
    }
}